<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/sys/include/taglib.jsp" %>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<%@ include file="/WEB-INF/adminui/include/css.jsp" %>
<title>加工生产环节列表</title>
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content ">
	<div class="row">
		<div class="col-sm-2">
			<div class="ibox ibox-body">
				<div class="ibox-title">
					<h5>选择作物</h5>
				</div>
				<div class="ibox-content">
					<div id="jstree"></div>
				</div>
			</div>
		</div>
		<div class="col-sm-9">
			<div class="ibox">
				<div class="ibox-body">
					<div class="fixed-table-toolbar">
						<div id="toolbar" class="columns pull-left">
							<qx:perm code="cropsjg_PROLINK_ADD">
							<button type="button" class="btn btn-primary" onclick="add()" uilist-hide="TYPE">
								<i class="fa fa-plus hidden" aria-hidden="true"></i>添加
							</button>
							</qx:perm>
							<qx:perm code="cropsjg_PROLINK_DEL">
							<button type="button" class="btn btn-danger multi" onclick="del()" uilist-hide="TYPE">
								<i class="fa fa-trash hidden" aria-hidden="true"></i>删除
							</button>
							</qx:perm>
						</div>
						<!-- <div class="columns pull-right">
							<button class="btn btn-success" onclick="UiList.loadTable()">查询</button>
						</div>
						<div class="columns pull-right col-md-2 nopadding">
							<input id="searchName" type="text" class="form-control" placeholder="按名称查询">
						</div>
					</div> -->
					<table id="dataTable" data-mobile-responsive="true">
					</table>
				</div>
			</div>
		</div>
	</div>
</div>
<%@ include file="/WEB-INF/adminui/include/script.jsp" %>
<script type="text/javascript">
$(function(){
	UiList.render({
		treeUrl: '${path}/crops_jg/lefttreeA.json',
		tableConfig:{
			url: "${path}/prolink_jg/listdata.json",
			idfield: 'linkid',
			columns: [
				{checkbox : true},
				{field : 'linkName', title : '环节名称'},
				{field : 'linkType', title : '环节分类',formatter : function(value, row, index) {
					switch(''+value){
					case '0': return '基本环节';
					case '1': return '特殊环节';
					case '2': return '成品环节';
					}
					return ''+value;
				}},
				{field : 'linkCode', title : '环节编码'},
				{field : 'linkid', title : '操作', align : 'center', formatter : function(value, row, index) {
					var s = '';
					<qx:perm code="cropsjg_PROLINK_EDIT">
					s += '<a class="btn btn-primary btn-sm" href="javascript:;" title="修改" onclick="edit(\''+value+'\')"><i class="fa fa-edit"></i></a>';
					</qx:perm>
					return s;
				}}
			]
		},
		tableParams: function(){//搜索条件
			return {search: $("#searchName").val()};
		}
	});
	
});

function add(){
	UiList.open('${path}/prolink_jg/add.do', '添加环节信息', {refresh:true});
}
function del(){
	UiList.dialog('${path}/prolink_jg/delete.json', '您确定要删除选中的环节信息吗？', '删除作物信息成功.', {refresh:true});
}
function edit(id){
	UiList.open('${path}/prolink_jg/edit.do?linkid='+id, '修改环节信息', {refresh:true});
}
</script>
</body>
</html>